<?php
/**
 * @copyright meila.com
 * @author gaojian3@
 * @name   获取用户美啦宣言
 * @param 
 *         $nick = 作用
 * 
 * 
 */
include('../../__global.php');

class aj_getDeclaration extends ml_controller 
{

    function initParam(){}
    /**
     * @develop_template
     * 检查参数合法性
     */
    function checkParam(){
        $this->check_referer();
        if(!$this->check_permission(ML_PERMISSION_LOGIN_ONLY)) {
            $this->api_output(ML_RCODE_NOLOGIN);
        }
        else if(!$this->check_permission(ML_PERMISSION_LOGIN_CANWRITE)) {
            $this->api_output(ML_RCODE_NOACTIVE);
        }
    }
    /**
     * @develop_template
     * 核心业务逻辑
     */
    function main()
    {
        //获取uid
        $uid = $this->__visitor['uid'];
        
        //实例化用户模型饼
        $oBrief = new ml_model_dbUserBriefInfo();
        
        if($oBrief->getDeclarationByUid($uid)){
            $briefData=$oBrief->get_data();
            $data=$briefData['declaration'];
            
            //判断用户宣言是否为空
//            if($data==''){
//                $this->api_output(ML_RCODE_FAIL,false);
//            }else{
                $this->api_output(ML_RCODE_SUCC,$data);
//            }
        }else{
            $this->api_output(ML_RCODE_BUSY,false);
        }
        
    }
}

new aj_getDeclaration();
